package br.mikhas.container.config;

/**
 * Describes a managed resource dependency that the container will suply during
 * resource life.
 * <p>
 * A dependecy may be a plain value or a resource reference but not both of
 * then.
 * 
 * @author Mikhail Domanoski
 * 
 */
public interface Dependency {

	/**
	 * Returns the name of the class or interface that fulfills the dependecy
	 */
	public Class<?> getType();

	/**
	 * Returns if the dependency must be supplied or its optional
	 */
	public boolean isRequired();

	/**
	 * Returns the name of the property which this dependency will be injected.
	 * 
	 * @return
	 */
	public String getPropertyName();

	/**
	 * Defines how this dependency will be used by the resource
	 * 
	 * @author Mikhail Domanoski
	 * 
	 */
	public enum DependencyTarget {
		/**
		 * Defines that this dependency will be used as a constructor argument
		 * to the resource
		 */
		Constructor,
		/**
		 * Defines that this dependency will be setted on the resource using a
		 * setter method
		 */
		Property,
		/**
		 * Defines that this dependency will be direct injected to an resource
		 * attribute
		 */
		Attribute
	}

	/**
	 * Gets how this dependency should be used to satisfy the resource
	 * dependency.
	 * 
	 * @see {@link Dependency}
	 * 
	 * @return
	 */
	public DependencyTarget getTarget();
}
